{% extends "../layouts/admin.html" %} {% block content %}
<header class="header navbar bg-white shadow">
	<div class="btn-group tool-button">
		<a class="btn btn-primary navbar-btn" href="/system/app/index" data-pjax><i class="ti-angle-left"></i> 返回</a>
	</div>
</header>

<div class="content-wrap">
	<div class="wrapper" style="min-height:500px;">
		<section class="panel panel-form">
			<form id="addForm" role="form" class="form-horizontal parsley-form" data-parsley-validate action="/system/app/add" method="post">
				<div class="row mb10">
					<div class="col-lg-12">
						<div class="form-group">
							<label for="name" class="col-sm-2 control-label">应用名称</label>

							<div class="col-sm-8">
								<input type="text" id="name" class="form-control" name="name" data-parsley-required="true" placeholder="名称">
							</div>
						</div>
						<div class="form-group">
							<label for="code" class="col-sm-2 control-label">标识</label>

							<div class="col-sm-8">
								<input type="text" id="code" class="form-control" name="code" data-parsley-required="true" placeholder="标识">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">类型</label>

							<div class="col-sm-8">
								

								<select class="form-control" name="type">
									<option value="" disabled selected>类型</option>
									{% for index,item in config.setup.appType %}
									<option value="{{index}}">{{item}}</option>
									{% endfor %}
								</select>

							</div>
						</div>

						<div class="form-group">
							<label for="description" class="col-sm-2 control-label">描述</label>

							<div class="col-sm-8">
								<textarea id="description" class="form-control" name="description" rows="3" placeholder="描述"></textarea>
								
							</div>
						</div>
						<div class="form-group">
							<label for="tables" class="col-sm-2 control-label">数据表</label>

							<div class="col-sm-8">
								<textarea id="tables" class="form-control" name="tables" rows="2" placeholder="多个数据表用‘,’号隔开，表名如：app_dwz_xxxx"></textarea>
								
							</div>
						</div>
						<div class="form-group">
              <label for="content" class="col-sm-2 control-label">是否有管理</label>

              <div class="col-sm-8">
                <div class="radio"><label>
                  <input type="radio" name="is_admin" value="1">是</label></div>
                  <div class="radio"><label>
                  <input type="radio" name="is_admin" value="0">否</label></div>


              </div>
            </div>
            <div class="form-group">
              <label for="content" class="col-sm-2 control-label">是否有配置</label>

              <div class="col-sm-8">
                <div class="radio"><label>
                  <input type="radio" name="is_setting" value="1">是</label></div>
                  <div class="radio"><label>
                  <input type="radio" name="is_setting" value="0">否</label></div>


              </div>
            </div>
						

						
						
						
					</div>
				</div>
				<div class="col-lg-3"></div>
				<div class="col-lg-6">
					<div class="form-group text-center">
						<label></label>

						<div>
							<button class="btn btn-primary btn-block btn-lg btn-parsley" data-loading-text="正在提交...">提 交</button>
						</div>
					</div>
				</div>
			</form>
		</section>

	</div>
</div>
<script language="JavaScript">
	$(document).ready(function() {
	
		$('#addForm').ajaxForm({
			dataType: 'json',
			beforeSubmit: function(arr, form, options) {
				form.find("button:submit").button("loading");
			},
			success: function(data, statusText, xhr, form) {
				if(data.errno == 0) {
					Toast.success(data.data);
					//刷新父级菜单
					form.resetForm();
				} else {
					Toast.error(data.errmsg);
				}
				form.find("button:submit").button("reset");
			}
		});
	});
</script>
{% endblock %}